package com.fieldchain.ex.fa100.utils.net.common;

import android.os.SystemClock;

import com.fieldchain.ex.fa100.access.Constant;
import com.fieldchain.ex.fa100.bean.User;
import com.fieldchain.ex.fa100.inter.IntegerCallBack;
import com.fieldchain.ex.fa100.utils.net.access.HttpRequest;
import com.fieldchain.ex.fa100.utils.net.modle.BeanRequest;
import com.fieldchain.ex.fa100.utils.share.ShareManager;

/**
 * Created by biyunlong
 * Email: 1225198434@qq.com
 * Data:  2018/9/12
 */
public class UpdateUser {
    public static void update(final IntegerCallBack callBack){
       HttpRequest.getInstance(). getRequest(Constant.user,"null", new BeanRequest<User>() {
            @Override
            public void onSucess(User user, int code, String msg) {
                if(code==200){
                    ShareManager.getInstance().saveUser(user);
                }
                SystemClock.sleep(50);
                callBack.index(code);
            }

            @Override
            public void onFaild(Exception e) {
                callBack.index(505);
            }
        });
    }
}
